﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sy4_7
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            LoadBackground();
            InitRocket();
            InitProgressBar();

            timer1.Interval = 10;
            timer1.Start();
        }
        private void LoadBackground()
        {
            Bitmap backPic = new Bitmap("发射场.jpg");
            this.BackgroundImage = backPic;
            this.ClientSize = new Size(backPic.Width, backPic.Height);
        }

        private void InitRocket()
        {
            Bitmap Pic = new Bitmap("火箭.gif");
            pictureBox1.Image = Pic;
            pictureBox1.BackColor = Color.Transparent;
            pictureBox1.Size = new Size(Pic.Width, Pic.Height);
            pictureBox1.Left = (this.ClientSize.Width - pictureBox1.Width) / 2;
            pictureBox1.Top = this.ClientSize.Height - pictureBox1.Height + 100;
        }

        private void InitProgressBar()
        {
            progressBar1.Dock = DockStyle.Top;
            progressBar1.Minimum = 0;
            progressBar1.Maximum = pictureBox1.Top + pictureBox1.Height;
            progressBar1.Value = 0;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            pictureBox1.Top--;
            progressBar1.Value++;

            if (progressBar1.Value >= progressBar1.Maximum)
            {
                timer1.Stop();
            }
        }
    }
}
